package com.hllxd.hism.framework.httprpc.service;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * @author xiyong.lxy
 * @date 2020-10-12 16:51
 */
@Slf4j
@RestGrpcService
@RestGrpcMapping("/framework/demo")
public class FrameworkDemoImpl {
    @Data
    public static class MessageDefine {
        private Long agentID;
        private String userID;
        private String content;
    }

    @RestGrpcMapping("/ping.do")
    public NTSTATUS ping(PDRIVER_OBJECT params, PRESULT_OBJECT result) {
        log.info("a: {}", params);
        try {
            MessageDefine aa = params.driverObject(MessageDefine.class);
            log.info("{}", aa.content);
            result.setData("success: " + aa.content);
            return NTSTATUS.SUCCESS_STATUS();
        }catch (Exception e) {
            log.error("Exception: {}.",e.toString(), e);
            return NTSTATUS.ERROR_STATUS("500", e.toString());
        }
    }
}
